export const userSet = () => {
  function saveUserData(
    name: string,
    photo: string,
    mobile: string,
    token: string
  ) {
    const userData = {
      name: name,
      photo: photo,
      mobile: mobile,
      token: token,
    };
    localStorage.setItem("userData", JSON.stringify(userData));
  }

  function getUserData() {
    const userData = localStorage.getItem("userData");
    if (userData) {
      return JSON.parse(userData);
    }
  }

  function getToken() {
    const userData = localStorage.getItem("userData");
    if (userData) {
      return JSON.parse(userData).token;
    }
  }
  function clearUserData() {
    localStorage.removeItem("userData");
  }
  function closeUserDialog() {
    return false;
  }
  return {
    saveUserData,
    getUserData,
    clearUserData,
    getToken,
    closeUserDialog,
  };
};
